package com.lyp.mvpsupermanage.user.presenter;

import android.os.Bundle;
import android.view.View;

import com.lyp.mvpsupermanage.user.view.base.Base1Fragment;

/**
 * 作者:ChenXi 时间:2017/7/27 17: 40
 */

public abstract class MvpFragment<P extends BasePresenter> extends Base1Fragment {
    protected P mvpPresenter;

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mvpPresenter = createPresenter();
    }

    protected abstract P createPresenter();


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (mvpPresenter != null) {
            mvpPresenter.detachView();
        }
    }
}
